home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / BBS-Archive / Dev / gcc263-src.lha / gcc-2.6.3 / config / convex / fixinc.convex < prev    next >
Text File  |  1994-07-14  |  9KB  |  417 lines

  1.  
  2. # This is a shell archive.  Remove anything before this line,
  3. # then unpack it by saving it in a file and typing "sh file".
  4. #
  5. # Wrapped by  on Fri Mar 12 08:41:28 CST 1993
  6. # Contents:  include/ include/limits.h include/math.h include/stddef.h
  7. #    include/stdlib.h
  8.  
  9. echo mkdir - include
  10. mkdir include
  11. chmod u=rwx,g=rwx,o=rx include
  12.  
  13. echo x - include/limits.h
  14. sed 's/^@//' > "include/limits.h" <<'@//E*O*F include/limits.h//'
  15. #ifndef _LIMITS_H
  16. #define _LIMITS_H
  17.  
  18. #include_next <limits.h>
  19.  
  20. /* Minimum and maximum values a `char' can hold.  */
  21. #ifdef __CHAR_UNSIGNED__
  22. #undef CHAR_MIN
  23. #define CHAR_MIN 0
  24. #undef CHAR_MAX
  25. #define CHAR_MAX 255
  26. #endif
  27.  
  28. #endif /* _LIMITS_H */
  29. @//E*O*F include/limits.h//
  30. chmod u=rw,g=rw,o=r include/limits.h
  31.  
  32. echo x - include/math.h
  33. sed 's/^@//' > "include/math.h" <<'@//E*O*F include/math.h//'
  34. #ifndef _MATH_H
  35. #define _MATH_H
  36.  
  37. #include_next <math.h>
  38.  
  39. #undef HUGE_VAL
  40.  
  41. #if _IEEE_FLOAT_
  42. #define HUGE_VAL 1.79769313486231570e+308
  43. #else
  44. #define HUGE_VAL 8.98846567431157854e+307
  45. #endif
  46.  
  47. #if __OPTIMIZE__ && ! __NO_INLINE
  48.  
  49. #define frexp(x,y)    __inline_frexp ((x), (y))
  50. #define ldexp(x,y)    __inline_ldexp ((x), (y))
  51. #define irint(x)    __inline_irint (x)
  52. #define frexpf(x,y)    __inline_frexpf ((x), (y))
  53. #define ldexpf(x,y)    __inline_ldexpf ((x), (y))
  54. #define irintf(x)    __inline_irintf (x)
  55.  
  56. #if __convex_c2__ || __convex_c32__ || __convex_c34__ || __convex_c38__
  57.  
  58. #define atan(x)        __inline_atan (x)
  59. #define ceil(x)        __inline_ceil (x)
  60. #define cos(x)        __inline_cos (x)
  61. #define exp(x)        __inline_exp (x)
  62. #define floor(x)    __inline_floor (x)
  63. #define log(x)        __inline_log (x)
  64. #define log10(x)    __inline_log10 (x)
  65. #define modf(x,y)    __inline_modf ((x), (y))
  66. #define rint(x)        __inline_rint (x)
  67. #define sin(x)        __inline_sin (x)
  68. #define sqrt(x)        __inline_sqrt (x)
  69.  
  70. #define atanf(x)    __inline_atanf (x)
  71. #define ceilf(x)    __inline_ceilf (x)
  72. #define cosf(x)        __inline_cosf (x)
  73. #define expf(x)        __inline_expf (x)
  74. #define floorf(x)    __inline_floorf (x)
  75. #define logf(x)        __inline_logf (x)
  76. #define log10f(x)    __inline_log10f (x)
  77. #define modff(x,y)    __inline_modff ((x), (y))
  78. #define rintf(x)    __inline_rintf (x)
  79. #define sinf(x)        __inline_sinf (x)
  80. #define sqrtf(x)    __inline_sqrtf (x)
  81.  
  82. #endif /* __convex_c[23*]__ */
  83.  
  84. #endif /* __OPTIMIZE__ */
  85.  
  86. static __inline__ __const__ double __inline_atan (double x)
  87. {
  88.   double z;
  89.   __asm__ ("atan.d %0" : "=d" (z) : "0" (x));
  90.   return z;
  91. }
  92.  
  93. static __inline__ __const__ float __inline_atanf (float x)
  94. {
  95.   float z;
  96.   __asm__ ("atan.s %0" : "=d" (z) : "0" (x));
  97.   return z;
  98. }
  99.  
  100. static __inline__ __const__ double __inline_cos (double x)
  101. {
  102.   double z;
  103.   __asm__ ("cos.d %0" : "=d" (z) : "0" (x));
  104.   return z;
  105. }
  106.  
  107. static __inline__ __const__ float __inline_cosf (float x)
  108. {
  109.   float z;
  110.   __asm__ ("cos.s %0" : "=d" (z) : "0" (x));
  111.   return z;
  112. }
  113.  
  114. static __inline__ __const__ double __inline_exp (double x)
  115. {
  116.   double z;
  117.   __asm__ ("exp.d %0" : "=d" (z) : "0" (x));
  118.   return z;
  119. }
  120.  
  121. static __inline__ __const__ float __inline_expf (float x)
  122. {
  123.   float z;
  124.   __asm__ ("exp.s %0" : "=d" (z) : "0" (x));
  125.   return z;
  126. }
  127.  
  128. static __inline__ __const__ double __inline_log (double x)
  129. {
  130.   double z;
  131.   __asm__ ("ln.d %0" : "=d" (z) : "0" (x));
  132.   return z;
  133. }
  134.  
  135. static __inline__ __const__ float __inline_logf (float x)
  136. {
  137.   float z;
  138.   __asm__ ("ln.s %0" : "=d" (z) : "0" (x));
  139.   return z;
  140. }
  141.  
  142. static __inline__ __const__ double __inline_sin (double x)
  143. {
  144.   double z;
  145.   __asm__ ("sin.d %0" : "=d" (z) : "0" (x));
  146.   return z;
  147. }
  148.  
  149. static __inline__ __const__ float __inline_sinf (float x)
  150. {
  151.   float z;
  152.   __asm__ ("sin.s %0" : "=d" (z) : "0" (x));
  153.   return z;
  154. }
  155.  
  156. static __inline__ __const__ double __inline_sqrt (double x)
  157. {
  158.   double z;
  159.   __asm__ ("sqrt.d %0" : "=d" (z) : "0" (x));
  160.   return z;
  161. }
  162.  
  163. static __inline__ __const__ float __inline_sqrtf (float x)
  164. {
  165.   float z;
  166.   __asm__ ("sqrt.s %0" : "=d" (z) : "0" (x));
  167.   return z;
  168. }
  169.  
  170. static __inline__ __const__ double __inline_ceil (double x)
  171. {
  172.   double z;
  173.   __asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x));
  174.   if (z < x) z += 1.0;
  175.   return z;
  176. }
  177.  
  178. static __inline__ __const__ float __inline_ceilf (float x)
  179. {
  180.   float z;
  181.   __asm__ ("frint.s %1,%0" : "=d" (z) : "d" (x));
  182.   if (z < x) z += 1.0F;
  183.   return z;
  184. }
  185.  
  186. static __inline__ __const__ double __inline_floor (double x)
  187. {
  188.   double z;
  189.   __asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x));
  190.   if (z > x) z -= 1.0;
  191.   return z;
  192. }
  193.  
  194. static __inline__ __const__ float __inline_floorf (float x)
  195. {
  196.   float z;
  197.   __asm__ ("frint.s %1,%0" : "=d" (z) : "d" (x));
  198.   if (z > x) z -= 1.0F;
  199.   return z;
  200. }
  201.  
  202. static __inline__ __const__ double __inline_log10 (double x)
  203. {
  204.   return 0.43429448190325182765 * __inline_log (x);
  205. }
  206.  
  207. static __inline__ __const__ float __inline_log10f (float x)
  208. {
  209.   return 0.43429448190325182765F * __inline_logf (x);
  210. }
  211.  
  212. static __inline__ double __inline_modf (double x, double *np)
  213. {
  214.   double intpart;
  215.   __asm__ ("frint.d %1,%0" : "=d" (intpart) : "d" (x));
  216.   *np = intpart;
  217.   return x - intpart;
  218. }
  219.  
  220. static __inline__ float __inline_modff (float x, float *np)
  221. {
  222.   float intpart;
  223.   __asm__ ("frint.s %1,%0" : "=d" (intpart) : "d" (x));
  224.   *np = intpart;
  225.   return x - intpart;
  226. }
  227.  
  228. static __inline__ double __inline_frexp (double x, int *np)
  229. {
  230.   union u { double d; unsigned long long ll; } u;
  231.   if ((u.d = x) == 0)
  232.     *np = 0;
  233.   else
  234.     {
  235. #if _IEEE_FLOAT_
  236.       *np = ((u.ll >> 52) & 03777) - 01776;
  237.       u.ll = (u.ll & 0x800fffffffffffffLL) | 0x3fe0000000000000LL;
  238. #else
  239.       *np = ((u.ll >> 52) & 03777) - 02000;
  240.       u.ll = (u.ll & 0x800fffffffffffffLL) | 0x4000000000000000LL;
  241. #endif
  242.     }
  243.   return u.d;
  244. }
  245.  
  246. static __inline__ float __inline_frexpf (float x, int *np)
  247. {
  248.   union u { float f; unsigned int i; } u;
  249.   if ((u.f = x) == 0)
  250.     *np = 0;
  251.   else
  252.     {
  253. #if _IEEE_FLOAT_
  254.       *np = ((u.i >> 23) & 0377) - 0176;
  255.       u.i = (u.i & 0x807fffff) | 0x3f000000;
  256. #else
  257.       *np = ((u.i >> 23) & 0377) - 0200;
  258.       u.i = (u.i & 0x807fffff) | 0x40000000;
  259. #endif
  260.     }
  261.   return u.f;
  262. }
  263.  
  264. static __inline__ double __inline_ldexp (double x, int n)
  265. {
  266.   extern int errno;
  267.   union { double d; long long ll; unsigned sexp : 12; } u;
  268.   if ((u.d = x) != 0)
  269.     {
  270.       int exp = n + (u.sexp & 03777);
  271.       long long nn = (long long) n << 52;
  272. #if _IEEE_FLOAT_
  273.       if (exp <= 0)
  274.     u.ll &= 0x8000000000000000LL, errno = 34;
  275.       else if (exp > 03776)
  276.     u.ll = u.ll & 0x8000000000000000LL | 0x7fefffffffffffffLL, errno = 34;
  277. #else
  278.       if (exp <= 0)
  279.     u.ll = 0, errno = 34;
  280.       else if (exp > 03777)
  281.     u.ll |= 0x7fffffffffffffffLL, errno = 34;
  282. #endif
  283.       else
  284.     u.ll += nn;
  285.     }
  286.   return u.d;
  287. }
  288.  
  289. static __inline__ float __inline_ldexpf (float x, int n)
  290. {
  291.   extern int errno;
  292.   union { float f; int i; unsigned sexp : 9; } u;
  293.   if ((u.f = x) != 0)
  294.     {
  295.       int exp = n + (u.sexp & 0377);
  296.       int nn = n << 23;
  297. #if _IEEE_FLOAT_
  298.       if (exp <= 0)
  299.     u.i &= 0x80000000, errno = 34;
  300.       else if (exp > 0376)
  301.     u.i = u.i & 0x80000000 | 0x7f7fffff, errno = 34;
  302. #else
  303.       if (exp <= 0)
  304.     u.i = 0, errno = 34;
  305.       else if (exp > 0377)
  306.     u.i |= 0x7fffffff, errno = 34;
  307. #endif
  308.       else
  309.     u.i += nn;
  310.     }
  311.   return u.f;
  312. }
  313.  
  314. static __inline__ __const__ double __inline_rint (double x)
  315. {
  316.   double z;
  317.   union { double d; unsigned long long ll; } u;
  318.   u.d = x;
  319. #if _IEEE_FLOAT_
  320.   u.ll = (u.ll & 0x8000000000000000LL) | 0x3fe0000000000000LL;
  321. #else
  322.   u.ll = (u.ll & 0x8000000000000000LL) | 0x4000000000000000LL;
  323. #endif
  324.   __asm__ ("frint.d %1,%0" : "=d" (z) : "d" (x + u.d));
  325.   return z;
  326. }
  327.  
  328. static __inline__ __const__ float __inline_rintf (float x)
  329. {
  330.   float z;
  331.   union { float f; unsigned int i; } u;
  332.   u.f = x;
  333. #if _IEEE_FLOAT_
  334.   u.i = (u.i & 0x80000000) | 0x3f000000;
  335. #else
  336.   u.i = (u.i & 0x80000000) | 0x40000000;
  337. #endif
  338.   __asm__ ("frint.s %1,%0" : "=d" (z) : "d" (x + u.f));
  339.   return z;
  340. }
  341.  
  342. static __inline__ __const__ int __inline_irint (double x)
  343. {
  344.   union { double d; unsigned long long ll; } u;
  345.   u.d = x;
  346. #if _IEEE_FLOAT_
  347.   u.ll = (u.ll & 0x8000000000000000LL) | 0x3fe0000000000000LL;
  348. #else
  349.   u.ll = (u.ll & 0x8000000000000000LL) | 0x4000000000000000LL;
  350. #endif
  351.   return x + u.d;
  352. }
  353.  
  354. static __inline__ __const__ int __inline_irintf (float x)
  355. {
  356.   union { float f; unsigned int i; } u;
  357.   u.f = x;
  358. #if _IEEE_FLOAT_
  359.   u.i = (u.i & 0x80000000) | 0x3f000000;
  360. #else
  361.   u.i = (u.i & 0x80000000) | 0x40000000;
  362. #endif
  363.   return x + u.f;
  364. }
  365.  
  366. #endif /* _MATH_H */
  367. @//E*O*F include/math.h//
  368. chmod u=rw,g=rw,o=r include/math.h
  369.  
  370. echo x - include/stddef.h
  371. sed 's/^@//' > "include/stddef.h" <<'@//E*O*F include/stddef.h//'
  372. #ifndef _STDDEF_H
  373. #define _STDDEF_H
  374.  
  375. #ifndef __WCHAR_T
  376. #define __WCHAR_T
  377.  
  378. #ifdef __GNUG__
  379. /* In C++, wchar_t is a distinct basic type,
  380.    and we can expect __wchar_t to be defined by cc1plus.  */
  381. typedef __wchar_t wchar_t;
  382. #else
  383. /* In C, cpp tells us which type to make an alias for.  */
  384. typedef __WCHAR_TYPE__ wchar_t;
  385. #endif
  386.  
  387. #endif /* __WCHAR_T */
  388.  
  389. #include_next <stddef.h>
  390.  
  391. #endif /* _STDDEF_H */
  392. @//E*O*F include/stddef.h//
  393. chmod u=rw,g=rw,o=r include/stddef.h
  394.  
  395. echo x - include/stdlib.h
  396. sed 's/^@//' > "include/stdlib.h" <<'@//E*O*F include/stdlib.h//'
  397. #ifndef    _STDLIB_H
  398. #define _STDLIB_H
  399.  
  400. #if _CONVEX_SOURCE
  401.  
  402. #define alloca __non_builtin_alloca
  403. #include_next <stdlib.h>
  404. #undef alloca
  405.  
  406. #else
  407.  
  408. #include_next <stdlib.h>
  409.  
  410. #endif  /* _CONVEX_SOURCE */
  411.  
  412. #endif    /* _STDLIB_H */
  413. @//E*O*F include/stdlib.h//
  414. chmod u=rw,g=rw,o=r include/stdlib.h
  415.  
  416. exit 0
  417.